package task1;

import java.util.ArrayList;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 东莞呵呵
 * Date:2022-09-16
 * Time:16:12
 */

class MyThread extends Thread{
    public static int count=0;
    @Override
    public void run() {
        System.out.println(count++);
    }
}

public class TestDemo1 {
    public static void main(String[] args) throws InterruptedException {
        List<MyThread> list=new ArrayList<>(20);
        for (int i = 0; i < 20; i++) {
            list.add(new MyThread());
        }
        for (int i = 0; i < 20; i++) {
            list.get(i).start();
            list.get(i).join();
        }
        System.out.println("OK");
    }
}
